{% extends "base_generic.html" %}

{% block content %}
  <div class="card">
    <h1>书名：{{ book.title }}</h1>
    <p><strong>作者：</strong> <a href="{% url 'author-detail' book.author.pk %}">{{ book.author }}</a></p>
    <p><strong>简介：</strong> {{ book.summary }}</p>
    <p><strong>ISBN：</strong> {{ book.isbn }}</p>
    <p><strong>语言：</strong> {{ book.language }}</p>
    <p><strong>分类：</strong> {% for genre in book.genre.all %} {{ genre }}{% if not forloop.last %}, {% endif %}{% endfor %}</p>
    <div style="margin-left:20px;margin-top:20px">
      <h4>副本信息</h4>
      {% for copy in book.bookinstance_set.all %}
        <hr>
        <p class="{% if copy.status == 'a' %}text-success{% elif copy.status == 'm' %}text-danger{% else %}text-warning{% endif %}">{{ copy.get_status_display }}</p>
        {% if copy.status != 'a' %}<p><strong>应归还日期：</strong> {{copy.due_back}}</p>{% endif %}
        <p><strong>版本信息：</strong> {{copy.imprint}}</p>
        <p class="text-muted"><strong>编号：</strong> {{copy.id}}</p>
      {% endfor %}
    </div>
  </div>
{% endblock %}
